//左侧导航
var leftNav = document.createElement('div');

leftNav.innerHTML =
	'<span class="icon iconfont hm-close">&#xe612;</span>'+
	'<div class="left-a">'+
		'<a class="left-a-self" href="index.html" title="首页"><span class="icon iconfont">&#xe611;</span></a>'+
	'</div>'+
	'<div class="right-ul">'+
		'<ul class="hideleft">'+
			'<li><a href="index.html"><img class="r-arrow" src="../img/1-arrow.png"/>首页</a></li>'+
		'</ul>'+
		
	'</div>';
			
$(".left-nav-box").append(leftNav);

//
var navList = mystorage.get("listNav");
//console.log(navList);
for(var i = 0; i<navList.length;i++){
	//左侧收缩菜单
	var html1 = 
	'<a class="left-a-self" href='+navList[i].purl+' title='+navList[i].name+'><span class="icon iconfont">'+navList[i].imageUrl+'</span></a>';
	$('.left-a').append(html1);
	//右侧隐藏菜单容器
	var html11 = 
	'<ul class="hideleft"></ul>';
	$('.right-ul').append(html11);
	
	for(var j = 0; j<navList[i].childrenList.length;j++){
		//右侧菜单
		var html12 = 
		'<li><a href='+navList[i].childrenList[j].purl+'><img class="r-arrow" src="../img/1-arrow.png"/>'+navList[i].childrenList[j].name+'</a></li>';
		//console.log(html12);
		$(".right-ul .hideleft").eq(i+1).append(html12);
	}
}



$('.right-ul ul li a').each(function(){
	$this = $(this);
	if($this[0].href == String(window.location)) {
		$this.addClass("right-licur");
		$this.parent().parent().addClass("showleft");
		$this.parent().parent().siblings('ul').removeClass("showleft");
	}
});
$('.left-a .left-a-self').mouseenter(function(){
	$(this).addClass('left-cur').siblings().removeClass('left-cur');
	var index = $(this).index();
	$('.right-ul ul').hide();
	$('.right-ul ul').eq(index).show();
});

$('.hm-close').click(function(){
	$('.left-nav-box').addClass('small-nav');
	$('.main-box').addClass('small-mainbox');
});

// var time1 = '30000';
// setTimeout('tokenOutTime()', time1);
// function tokenOutTime(){
//  var tokenNow = mystorage.get("test");
//  alert('时间已经过5秒，这个token已经过期：'+tokenNow);
//  mystorage.remove("test");
//  window.location.href = "login.html";
// }